Skip to content

Conversation

@davidfillmore
Copy link
Collaborator

@davidfillmore davidfillmore commented Nov 25, 2025

  • Implemented builder-level support for future constraints without changing current behavior: added constraint count/name setters and used them to size Jacobian/state vectors and extend variable names, while carrying the count into StateParameters (include/micm/solver/solver_builder.hpp, include/micm/solver/solver_builder.inl). State now honors the provided constraint count when building identity masks and Jacobian dimensions (include/micm/solver/state.inl). AlphaMinusJacobian applies αI using a row-aware identity mask, preparing for masked constraint rows (include/micm/solver/rosenbrock.inl). Tests: cmake --build build and ctest --output-on-failure (all 48 tests passed).

davidfillmore and others added 12 commits October 15, 2025 11:11
…ging current behavior: added constraint count/name setters and used them to size Jacobian/state vectors and extend variable names, while carrying the count into StateParameters (include/micm/solver/solver_builder.hpp, include/micm/solver/solver_builder.inl). State now honors the provided constraint count when building identity masks and Jacobian dimensions (include/micm/solver/state.inl). AlphaMinusJacobian applies αI using a row-aware identity mask, preparing for masked constraint rows (include/micm/solver/rosenbrock.inl). Tests: cmake --build build and ctest --output-on-failure (all 48 tests passed).
@davidfillmore davidfillmore changed the title rosenbrock dae Rosenbrock DAE Constraint Count Nov 25, 2025
@codecov-commenter
Copy link

codecov-commenter commented Jan 14, 2026

Codecov Report

❌ Patch coverage is 97.11538% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.79%. Comparing base (1d4fa14) to head (57f6eaa).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
include/micm/constraint/equilibrium_constraint.hpp 93.44% 4 Missing ⚠️
include/micm/constraint/constraint_set.hpp 97.22% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #880      +/-   ##
==========================================
+ Coverage   94.66%   94.79%   +0.12%     
==========================================
  Files          66       69       +3     
  Lines        3245     3440     +195     
==========================================
+ Hits         3072     3261     +189     
- Misses        173      179       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

dwfncar and others added 8 commits January 13, 2026 20:43
Implement algebraic constraint support for the Rosenbrock solver:

- Add Constraint base class and EquilibriumConstraint for chemical equilibria
- Add ConstraintSet manager following ProcessSet pattern
- Add SolverBuilder.SetConstraints() API to inject constraints
- Modify State to include constraint variables with identity diagonal
- Integrate constraint forcing and Jacobian into Rosenbrock solver loop
- Fix temporary variable sizing to include constraint dimensions

Infrastructure is complete with 55 passing tests. Full DAE time integration
requires additional solver modifications (documented in TODO.md).

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Modified AlphaMinusJacobian() to add alpha to ALL diagonal elements,
not just ODE rows. This treats algebraic constraints as stiff ODEs
(ε*z' = g(y,z) with ε=hγ), ensuring K values scale with step size H
and preventing numerical instability from c/H terms in Rosenbrock
stage computation.

Changes:
- rosenbrock.inl: Add alpha to all diagonals in both vectorized and
  non-vectorized AlphaMinusJacobian() implementations
- test_equilibrium.cpp: Add DAESolveWithConstraint integration test
  demonstrating working DAE solve with projection step
- Update ARCHITECTURE.md and TODO.md with fix documentation

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Custom skills for building, testing, and debugging MICM:
- /micm-test: Build and run tests (all, filtered, or build-only)
- /debug-test: Debug failing tests with tracing support
- /solver-debug: Investigate numerical solver issues

These skills codify the debugging strategies used during DAE
constraint development, including matrix conditioning checks,
K value tracing, and sign convention verification.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Documents DAE constraint system architecture, debugging strategies,
and available skills for AI-assisted development sessions.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Created comprehensive test case library for DAE constraint validation:
- Atmospheric equilibria (carbonate, ammonia, SO2)
- Multi-constraint systems (iron-oxalate, O3-NOx PSS)
- Stiff/numerical challenges (extreme K, temperature-dependent)
- Practical applications (ISORROPIA-style, Chapman mechanism)
- Edge cases (constraint switching, near-singular)

Updated TODO.md: Chapman mechanism with QSSA constraint is next.
This will require QSSAConstraint or CustomConstraint implementation.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Tests should write CSV to stdout for plotting:
- Header line with column names
- One line per timestep with all state variables
- Include analytical values where available
- Redirect to file: ./test_chapman > results.csv

Enables visual validation with Python/gnuplot.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Provides a copy-paste prompt to continue DAE work:
- Points to TODO.md and TESTS.md
- Identifies Chapman mechanism as next task
- Suggests build/test verification first

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Documents the approach for merging the DAE constraint system
into main via three incremental, reviewable PRs.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@dwfncar
Copy link
Collaborator

dwfncar commented Jan 18, 2026

Breaking PR into 3 smaller PRs.

@dwfncar dwfncar closed this Jan 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants